package com.ymatou.query.trading.api.testcase;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.seller.trading.api.parameter.OrderEntities;
import com.ymatou.query.seller.trading.api.parameter.Sp_GetSingleOrderInfo_1;
import com.ymatou.query.seller.trading.api.parameter.Ymt_O_OrderNote;
import com.ymatou.query.seller.trading.api.parameter.Ymt_Order;
import com.ymatou.query.seller.trading.api.parameter.Ymt_OrderInfo;
import com.ymatou.query.seller.trading.api.parameter.Ymt_OrderState;
import com.ymatou.query.seller.trading.api.parameter.Ymt_OrderSummary;
import com.ymatou.query.trading.api.parameter.GetSingleOrderInfoBean;
import com.ymatou.query.trading.api.parameter.OrderConverter;
import com.ymatou.query.trading.api.parameter.resp.GetSingleOrderInfoResp;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.common.entitie.OrderItemInfo;
import com.ymttest.common.entitie.OrderItemInfoExt;
import com.ymttest.common.entitie.OrderSummary;
import com.ymttest.database.model.Ymt_Bill;
import com.ymttest.database.model.Ymt_CreditDetail;
import com.ymttest.database.model.Ymt_OrderExt;
import com.ymttest.database.model.Ymt_OrderPostPay;
import com.ymttest.database.model.Ymt_OrderToBill;
import com.ymttest.database.model.Ymt_Order_Frozen;
import com.ymttest.database.model.Ymt_TradingItem;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.constant.ECode;

/**
 * 获取单个订单信息 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetSingleOrderInfo {

	private static GetSingleOrderInfoBean gsoibean;
	private static com.ymatou.query.trading.api.service.GetSingleOrderInfoCall gsoicall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取单个订单信息");
	}

	@Before
	public void caseUp() {
		gsoibean = new GetSingleOrderInfoBean();
		gsoicall = new com.ymatou.query.trading.api.service.GetSingleOrderInfoCall();
	}

	private void verify() {
		GetSingleOrderInfoResp expectedResponse = new GetSingleOrderInfoResp();
		ConstructExpectedResponse(expectedResponse);
		GetSingleOrderInfoResp actualResponse = gsoicall
				.getSingleOrderInfoResponse();
		com.ymatou.query.seller.trading.api.parameter.OrderInfo expect = expectedResponse
				.getOrderInfo();
		com.ymatou.query.seller.trading.api.parameter.OrderInfo actual = actualResponse
				.getOrderInfo();
		if (expect == null) {
			DataUtil.verify(expect, actual, "验证OrderInfo=null");
		} else {
			DataUtil.verify(expect.getTotalRefundThirdPartyDiscount(),
					actual.getTotalRefundThirdPartyDiscount(),
					"验证OrderInfo.TotalRefundThirdPartyDiscount");

			DataUtil.verify(expect.getIsFirstOrder(), actual.getIsFirstOrder(),
					"验证OrderInfo.IsFirstOrder");
			DataUtil.verify(expect.isPreSaleOrder(), actual.isPreSaleOrder(),
					"验证OrderInfo.PreSaleOrder");
			DataUtil.verify(expect.getDiscountOfThirdParty(),
					actual.getDiscountOfThirdParty(),
					"验证OrderInfo.DiscountOfThirdParty");
			DataUtil.verifyDateEquals(expect.getAcceptTime(),
					actual.getAcceptTime(), "验证OrderInfo.AcceptTime");
			DataUtil.verify(expect.getAddress(), actual.getAddress(),
					"验证OrderInfo.Address");
			DataUtil.verifyDateEquals(expect.getAddTime(), actual.getAddTime(),
					"验证OrderInfo.AddTime");
			DataUtil.verifyDateEquals(expect.getApplyPostPayTime(),
					actual.getApplyPostPayTime(),
					"验证OrderInfo.ApplyPostPayTime");
			DataUtil.verify(expect.getAutoCancelOrderHours(),
					actual.getAutoCancelOrderHours(),
					"验证OrderInfo.AutoCancelOrderHours");
			DataUtil.verifyDateEquals(expect.getAutoReceiveTime(),
					actual.getAutoReceiveTime(), "验证OrderInfo.AutoReceiveTime");
			DataUtil.verify(expect.getBillCodeList(), actual.getBillCodeList(),
					"验证OrderInfo.BillCodeList");
			DataUtil.verify(expect.getBillInfoList(), actual.getBillInfoList(),
					"验证OrderInfo.BillInfoList");
			DataUtil.verify(expect.getBuyerId(), actual.getBuyerId(),
					"验证OrderInfo.BuyerId");
			DataUtil.verify(expect.getBuyerLoginEmail(),
					actual.getBuyerLoginEmail(), "验证OrderInfo.BuyerLoginEmail");
			DataUtil.verify(expect.getBuyerLoginId(), actual.getBuyerLoginId(),
					"验证OrderInfo.BuyerLoginId");
			DataUtil.verify(expect.getBuyerNickName(),
					actual.getBuyerNickName(), "验证OrderInfo.BuyerNickName");
			DataUtil.verifyDateEquals(expect.getCancelTime(),
					actual.getCancelTime(), "验证OrderInfo.CancelTime");
			DataUtil.verifyDateEquals(expect.getChangeAddressTime(),
					actual.getChangeAddressTime(),
					"验证OrderInfo.ChangeAddressTime");
			DataUtil.verifyDateEquals(expect.getConfirmedTime(),
					actual.getConfirmedTime(), "验证OrderInfo.ConfirmedTime");
			DataUtil.verify(expect.getCouponCode(), actual.getCouponCode(),
					"验证OrderInfo.CouponCode");
			DataUtil.verify(expect.getCouponType(), actual.getCouponType(),
					"验证OrderInfo.CouponType");
			DataUtil.verify(expect.getCouponValue(), actual.getCouponValue(),
					"验证OrderInfo.CouponValue");
			DataUtil.verifyDateEquals(expect.getCreditAddTime(),
					actual.getCreditAddTime(), "验证OrderInfo.CreditAddTime");
			DataUtil.verify(expect.getCreditDescript(),
					actual.getCreditDescript(), "验证OrderInfo.CreditDescript");
			DataUtil.verify(expect.isCredited(), actual.isCredited(),
					"验证OrderInfo.Credited");
			DataUtil.verify(expect.getCreditId(), actual.getCreditId(),
					"验证OrderInfo.CreditId");
			DataUtil.verify(expect.getCreditScoreRange(),
					actual.getCreditScoreRange(),
					"验证OrderInfo.CreditScoreRange");
			DataUtil.verify(expect.getCreditSellerReply(),
					actual.getCreditSellerReply(),
					"验证OrderInfo.CreditSellerReply");
			DataUtil.verifyDateEquals(expect.getCreditSellerReplyUpdateTime(),
					actual.getCreditSellerReplyUpdateTime(),
					"验证OrderInfo.CreditSellerReplyUpdateTime");
			DataUtil.verify(expect.getCreditServiceRange(),
					actual.getCreditServiceRange(),
					"验证OrderInfo.CreditServiceRange");
			DataUtil.verify(expect.getCreditUniformityRange(),
					actual.getCreditUniformityRange(),
					"验证OrderInfo.CreditUniformityRange");
			DataUtil.verifyDateEquals(expect.getCreditUpdateTime(),
					actual.getCreditUpdateTime(),
					"验证OrderInfo.CreditUpdateTime");
			DataUtil.verify(expect.getCreditUserId(), actual.getCreditUserId(),
					"验证OrderInfo.CreditUserId");
			DataUtil.verifyDateEquals(expect.getDelayReceiveAddTime(),
					actual.getDelayReceiveAddTime(),
					"验证OrderInfo.DelayReceiveAddTime");
			DataUtil.verify(expect.isDelayReceiveFrozened(),
					actual.isDelayReceiveFrozened(),
					"验证OrderInfo.DelayReceiveFrozened");
			DataUtil.verifyDateEquals(expect.getDelayReceiveFrozenTime(),
					actual.getDelayReceiveFrozenTime(),
					"验证OrderInfo.DelayReceiveFrozenTime");
			DataUtil.verifyDateEquals(expect.getDelayReceiveUpdateTime(),
					actual.getDelayReceiveUpdateTime(),
					"验证OrderInfo.DelayReceiveUpdateTime");
			DataUtil.verify(expect.getDelayReceiveUserId(),
					actual.getDelayReceiveUserId(),
					"验证OrderInfo.DelayReceiveUserId");
			DataUtil.verify(expect.getDiscount(), actual.getDiscount(),
					"验证OrderInfo.Discount");
			DataUtil.verifyDateEquals(expect.getDiscountTime(),
					actual.getDiscountTime(), "验证OrderInfo.DiscountTime");
			DataUtil.verifyDateEquals(expect.getDispatchTime(),
					actual.getDispatchTime(), "验证OrderInfo.DispatchTime");
			DataUtil.verifyDateEquals(expect.getDispathTime(),
					actual.getDispathTime(), "验证OrderInfo.DispathTime");
			DataUtil.verify(expect.getDistributor(), actual.getDistributor(),
					"验证OrderInfo.Distributor");
			DataUtil.verify(expect.getEmail(), actual.getEmail(),
					"验证OrderInfo.Email");
			DataUtil.verify(expect.getFirstPay(), actual.getFirstPay(),
					"验证OrderInfo.FirstPay");
			DataUtil.verify(expect.getFreight(), actual.getFreight(),
					"验证OrderInfo.Freight");
			DataUtil.verify(expect.isFrozen(), actual.isFrozen(),
					"验证OrderInfo.Frozen");
			DataUtil.verify(expect.isIsAutoReceiveEnabled(),
					actual.isIsAutoReceiveEnabled(),
					"验证OrderInfo.IsAutoReceiveEnabled");
			DataUtil.verify(expect.getIsMerchant(), actual.getIsMerchant(),
					"验证OrderInfo.IsMerchant");
			DataUtil.verify(expect.isIsShippedByXlobo(),
					actual.isIsShippedByXlobo(), "验证OrderInfo.IsShippedByXlobo");
			DataUtil.verify(expect.getLeaveWord(), actual.getLeaveWord(),
					"验证OrderInfo.LeaveWord");
			DataUtil.verify(expect.getLogisticsType(),
					actual.getLogisticsType(), "验证OrderInfo.LogisticsType");
			DataUtil.verify(expect.getNeedPostPay(), actual.getNeedPostPay(),
					"验证OrderInfo.NeedPostPay");
			DataUtil.verify(expect.getNeedPrePayAmountOfCash(),
					actual.getNeedPrePayAmountOfCash(),
					"验证OrderInfo.NeedPrePayAmountOfCash");
			DataUtil.verify(expect.getOldDiscount(), actual.getOldDiscount(),
					"验证OrderInfo.OldDiscount");
			DataUtil.verify(expect.getOldFreight(), actual.getOldFreight(),
					"验证OrderInfo.OldFreight");
			DataUtil.verify(expect.getOperate(), actual.getOperate(),
					"验证OrderInfo.Operate");
			DataUtil.verifyDateEquals(expect.getOperateExpireTime(),
					actual.getOperateExpireTime(),
					"验证OrderInfo.OperateExpireTime");
			DataUtil.verify(expect.getOrderDiscount(),
					actual.getOrderDiscount(), "验证OrderInfo.OrderDiscount");
			DataUtil.verify(expect.getOrderId(), actual.getOrderId(),
					"验证OrderInfo.OrderId");
			if (expect.getOrderItemList() == null) {
				DataUtil.verify(expect.getOrderItemList(),
						actual.getOrderItemList(),
						"验证OrderInfo.OrderItemList=null");
			} else {
				if (!DataUtil.isNullOrEmpty(expect.getOrderItemList())) {
					DataUtil.verify(expect.getOrderItemList().size(), actual
							.getOrderItemList().size(),
							"验证OrderInfo.OrderItemList.size()");
					boolean equal = expect.getOrderItemList().size() == actual
							.getOrderItemList().size();
					if (equal) {
						for (OrderItemInfo exp : expect.getOrderItemList()) {
							String expPid = exp.getProductId();
							boolean exists = actual
									.getOrderItemList()
									.stream()
									.anyMatch(
											x -> x.getProductId()
													.equals(expPid));
							DataUtil.verify(true, exists, "验证ProductId=["
									+ expPid
									+ "]是否存在于OrderInfo.OrderItemList.size()");
							if (exists) {
								OrderItemInfo act = actual
										.getOrderItemList()
										.stream()
										.filter(x -> x.getProductId().equals(
												expPid))
										.collect(Collectors.toList()).get(0);
								verifyOrderItemList(exp, act, expPid);
							}
						}
					}
				}
			}
			DataUtil.verify(expect.getOrderPrice(), actual.getOrderPrice(),
					"验证OrderInfo.OrderPrice");
			DataUtil.verify(expect.isPaidInFull(), actual.isPaidInFull(),
					"验证OrderInfo.PaidInFull");
			DataUtil.verifyDateEquals(expect.getPaidTime(),
					actual.getPaidTime(), "验证OrderInfo.PaidTime");
			DataUtil.verify(expect.getPhone(), actual.getPhone(),
					"验证OrderInfo.Phone");
			DataUtil.verify(expect.getPlatformEnum(), actual.getPlatformEnum(),
					"验证OrderInfo.PlatformEnum");
			DataUtil.verify(expect.getPostCode(), actual.getPostCode(),
					"验证OrderInfo.PostCode");
			DataUtil.verify(expect.getPostPaidAmountOfCoupon(),
					actual.getPostPaidAmountOfCoupon(),
					"验证OrderInfo.PostPaidAmountOfCoupon");
			DataUtil.verify(expect.getPostPaidAmountOfGift(),
					actual.getPostPaidAmountOfGift(),
					"验证OrderInfo.PostPaidAmountOfGift");
			DataUtil.verifyDateEquals(expect.getPostPaidTime(),
					actual.getPostPaidTime(), "验证OrderInfo.PostPaidTime");
			DataUtil.verify(expect.getQQ(), actual.getQQ(), "验证OrderInfo.QQ");
			DataUtil.verify(expect.getRealPaidAmountOfCash(),
					actual.getRealPaidAmountOfCash(),
					"验证OrderInfo.RealPaidAmountOfCash");
			DataUtil.verify(expect.getRealPaidAmountOfGift(),
					actual.getRealPaidAmountOfGift(),
					"验证OrderInfo.RealPaidAmountOfGift");
			DataUtil.verify(expect.getRealPay(), actual.getRealPay(),
					"验证OrderInfo.RealPay");
			DataUtil.verify(expect.getRealPostPay(), actual.getRealPostPay(),
					"验证OrderInfo.RealPostPay");
			DataUtil.verify(expect.getReceivePerson(),
					actual.getReceivePerson(), "验证OrderInfo.ReceivePerson");
			DataUtil.verify(expect.getRefund(), actual.getRefund(),
					"验证OrderInfo.Refund");
			DataUtil.verify(expect.getReplyTopicWhenOrderPaid(),
					actual.getReplyTopicWhenOrderPaid(),
					"验证OrderInfo.ReplyTopicWhenOrderPaid");
			DataUtil.verify(expect.getSellerLoginEmail(),
					actual.getSellerLoginEmail(),
					"验证OrderInfo.SellerLoginEmail");
			DataUtil.verify(expect.getSellerLoginId(),
					actual.getSellerLoginId(), "验证OrderInfo.SellerLoginId");
			DataUtil.verify(expect.getSellerNote(), actual.getSellerNote(),
					"验证OrderInfo.SellerNote");
			DataUtil.verify(expect.isShangouOrder(), actual.isShangouOrder(),
					"验证OrderInfo.ShangouOrder");
			DataUtil.verify(expect.getStockStatus(), actual.getStockStatus(),
					"验证OrderInfo.StockStatus");
			DataUtil.verify(expect.getTelephone(), actual.getTelephone(),
					"验证OrderInfo.Telephone");
			DataUtil.verify(expect.getThirdOrderId(), actual.getThirdOrderId(),
					"验证OrderInfo.ThirdOrderId");
			DataUtil.verify(expect.getThirdPartyRefundStatus(),
					actual.getThirdPartyRefundStatus(),
					"验证OrderInfo.ThirdPartyRefundStatus");
			DataUtil.verify(expect.getTitle(), actual.getTitle(),
					"验证OrderInfo.Title");
			DataUtil.verify(expect.getTopicId(), actual.getTopicId(),
					"验证OrderInfo.TopicId");
			DataUtil.verify(expect.getTotalPrice(), actual.getTotalPrice(),
					"验证OrderInfo.TotalPrice");
			DataUtil.verify(expect.getTradingId(), actual.getTradingId(),
					"验证OrderInfo.TradingId");
			DataUtil.verify(expect.getTradingStatus(),
					actual.getTradingStatus(), "验证OrderInfo.TradingStatus");
			DataUtil.verify(expect.getType(), actual.getType(),
					"验证OrderInfo.Type");
			DataUtil.verify(expect.getUnfreezeStatus(),
					actual.getUnfreezeStatus(), "验证OrderInfo.UnfreezeStatus");
			DataUtil.verify(expect.getUseFreeCardAmount(),
					actual.getUseFreeCardAmount(),
					"验证OrderInfo.UseFreeCardAmount");
			DataUtil.verify(expect.getUseGiftAmount(),
					actual.getUseGiftAmount(), "验证OrderInfo.UseGiftAmount");
			DataUtil.verify(expect.getUserId(), actual.getUserId(),
					"验证OrderInfo.UserId");
			DataUtil.verify(expect.getBusynessTypeList(),
					actual.getBusynessTypeList(),
					"验证OrderInfo.BusynessTypeList");
			DataUtil.verify(expect.getCancelReason(), actual.getCancelReason(),
					"验证OrderInfo.CancelReason");
			DataUtil.verify(expect.isHaveUploadedIdCard(),
					actual.isHaveUploadedIdCard(),
					"验证OrderInfo.HaveUploadedIdCard");
			DataUtil.verify(expect.getIsNewCustomerOrder(),
					actual.getIsNewCustomerOrder(),
					"验证OrderInfo.IsNewCustomerOrder");
			DataUtil.verify(expect.getIsNewSellerOrder(),
					actual.getIsNewSellerOrder(),
					"验证OrderInfo.IsNewSellerOrder");
			DataUtil.verify(expect.getLocalRefundApplyTime(),
					actual.getLocalRefundApplyTime(),
					"验证OrderInfo.LocalRefundApplyTime");
			DataUtil.verify(expect.getMainOrderId(), actual.getMainOrderId(),
					"验证OrderInfo.MainOrderId");
			DataUtil.verify(expect.isNeedUploadIdCard(),
					actual.isNeedUploadIdCard(), "验证OrderInfo.NeedUploadIdCard");
			DataUtil.verify(expect.getPackageDelivery_DomesticDelivered(),
					actual.getPackageDelivery_DomesticDelivered(),
					"验证OrderInfo.PackageDelivery_DomesticDelivered");
			DataUtil.verify(expect.getPaidAmountOfCoupon(),
					actual.getPaidAmountOfCoupon(),
					"验证OrderInfo.PaidAmountOfCoupon");
			DataUtil.verify(expect.getPaidAmountOfFreeCard(),
					actual.getPaidAmountOfFreeCard(),
					"验证OrderInfo.PaidAmountOfFreeCard");
			DataUtil.verify(expect.getPaidAmountOfYmtCoupon(),
					actual.getPaidAmountOfYmtCoupon(),
					"验证OrderInfo.PaidAmountOfYmtCoupon");
			DataUtil.verify(expect.getPayableAmount(),
					actual.getPayableAmount(), "验证OrderInfo.PayableAmount");
			DataUtil.verify(expect.getPromotionReducedAmount(),
					actual.getPromotionReducedAmount(),
					"验证OrderInfo.PromotionReducedAmount");
			DataUtil.verify(expect.getRealSettlementAmountOfCoupon(),
					actual.getRealSettlementAmountOfCoupon(),
					"验证OrderInfo.RealSettlementAmountOfCoupon");
			DataUtil.verify(expect.getRemarkLevel(), actual.getRemarkLevel(),
					"验证OrderInfo.RemarkLevel");
			DataUtil.verify(expect.getRiskVerifiedStatus(),
					actual.getRiskVerifiedStatus(),
					"验证OrderInfo.RiskVerifiedStatus");
			DataUtil.verify(expect.getSalesRefundStatus(),
					actual.getSalesRefundStatus(),
					"验证OrderInfo.SalesRefundStatus");
			DataUtil.verify(expect.getSellerCouponAmount(),
					actual.getSellerCouponAmount(),
					"验证OrderInfo.SellerCouponAmount");
			DataUtil.verify(expect.getSellerCouponCode(),
					actual.getSellerCouponCode(),
					"验证OrderInfo.SellerCouponCode");
			DataUtil.verify(expect.isSupportLocalRefund(),
					actual.isSupportLocalRefund(),
					"验证OrderInfo.SupportLocalRefund");
			DataUtil.verify(expect.getTotalPriceChange(),
					actual.getTotalPriceChange(),
					"验证OrderInfo.TotalPriceChange");
			DataUtil.verify(expect.getTotalSalesRefundAmount(),
					actual.getTotalSalesRefundAmount(),
					"验证OrderInfo.TotalSalesRefundAmount");
			DataUtil.verify(expect.getYmtCouponAmount(),
					actual.getYmtCouponAmount(), "验证OrderInfo.YmtCouponAmount");
			DataUtil.verify(expect.getYmtCouponCode(),
					actual.getYmtCouponCode(), "验证OrderInfo.YmtCouponCode");
			if (null == expect.getOrderSummaryList()) {
				DataUtil.verify(expect.getOrderSummaryList(),
						actual.getOrderSummaryList(),
						"验证OrderInfo.OrderSummaryList=null");
			} else {
				if (!DataUtil.isNullOrEmpty(expect.getOrderSummaryList())) {
					for (OrderSummary exp : expect.getOrderSummaryList()) {
						Integer expType = exp.getBillType();
						String expSummary = exp.getSummary();
						DataUtil.verify(
								true,
								actual.getOrderSummaryList()
										.stream()
										.anyMatch(
												x -> x.getBillType() == expType
														&& x.getSummary()
																.equals(expSummary)),
								"验证OrderInfo.OrderSummaryList中是否存在BillType=["
										+ expType + "],Summary=[" + expSummary
										+ "]的记录");
					}
				}
			}
		}
	}

	private void verifyOrderItemList(OrderItemInfo exp, OrderItemInfo act,
			String expPid) {
		DataUtil.verify(exp.getAmount(), act.getAmount(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的Amount");
		DataUtil.verify(exp.getBondedArea(), act.getBondedArea(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的BondedArea");
		DataUtil.verify(exp.getCatalogId(), act.getCatalogId(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的CatalogId");
		DataUtil.verify(exp.getDescription(), act.getDescription(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的Description");
		DataUtil.verify(exp.getDiscount(), act.getDiscount(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的Discount");
		DataUtil.verify(exp.getFreight(), act.getFreight(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的Freight");
		DataUtil.verify(exp.getFreightFree(), act.getFreightFree(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的FreightFree");
		DataUtil.verify(exp.isIsCost(), act.isIsCost(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的IsCost");
		DataUtil.verify(exp.getItemType(), act.getItemType(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的ItemType");
		DataUtil.verify(exp.getLogisticsType(), act.getLogisticsType(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的LogisticsType");
		DataUtil.verify(exp.getOrderItemId(), act.getOrderItemId(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的OrderItemId");
		DataUtil.verify(exp.getPictureUrl(), act.getPictureUrl(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的PictureUrl");
		DataUtil.verify(exp.getPremium(), act.getPremium(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的Premium");
		DataUtil.verify(exp.getPrice(), act.getPrice(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的Price");
		DataUtil.verify(exp.getPriceType(), act.getPriceType(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的PriceType");
		DataUtil.verify(exp.getProductId(), act.getProductId(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的ProductId");
		DataUtil.verify(exp.getProductOriginalPrice(),
				act.getProductOriginalPrice(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的ProductOriginalPrice");
		DataUtil.verify(exp.getProductPrice(), act.getProductPrice(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的ProductPrice");
		DataUtil.verify(exp.getProductRefundChannel(),
				act.getProductRefundChannel(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的ProductRefundChannel");
		DataUtil.verify(exp.getPromotion(), act.getPromotion(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的Promotion");
		DataUtil.verify(exp.getPropertyInfo(), act.getPropertyInfo(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的PropertyInfo");
		// DataUtil.verify(exp.getReferenceUrl(), act.getReferenceUrl(),
		// "验证OrderInfo.OrderItemList中ProductId=["+expPid+"]的ReferenceUrl");
		DataUtil.verify(exp.getRefundBillNo(), act.getRefundBillNo(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的RefundBillNo");
		DataUtil.verify(exp.isSailProtected(), act.isSailProtected(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的SailProtected");
		DataUtil.verify(exp.getSalesType(), act.getSalesType(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的SalesType");
		DataUtil.verify(exp.getSellerCouponAmount(),
				act.getSellerCouponAmount(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的SellerCouponAmount");
		DataUtil.verify(exp.getSku(), act.getSku(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的Sku");
		DataUtil.verify(exp.getStockStatus(), act.getStockStatus(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的StockStatus");
		DataUtil.verify(exp.getSubProductCategoryId(),
				act.getSubProductCategoryId(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的SubProductCategoryId");
		DataUtil.verify(exp.isSupportRtnWithoutReason(),
				act.isSupportRtnWithoutReason(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的SupportRtnWithoutReason");
		DataUtil.verify(exp.getTariffType(), act.getTariffType(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的TariffType");
		DataUtil.verify(exp.getTitle(), act.getTitle(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的Title");
		DataUtil.verify(exp.getYmtCouponAmount(), act.getYmtCouponAmount(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的YmtCouponAmount");
		DataUtil.verify(exp.isPreSale(), act.isPreSale(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid + "]的PreSale");
		DataUtil.verify(exp.getThirdPartyDiscount(),
				act.getThirdPartyDiscount(),
				"验证OrderInfo.OrderItemList中ProductId=[" + expPid
						+ "]的ThirdPartyDiscount");
		OrderItemInfoExt expExt = exp.getOrderItemInfoExt();
		OrderItemInfoExt actExt = act.getOrderItemInfoExt();
		if (null == expExt) {
			DataUtil.verify(expExt, actExt,
					"验证OrderInfo.OrderItemList中ProductId=[" + expPid
							+ "]的OrderItemInfoExt");
		} else {
			DataUtil.verify(expExt.getActivityId(), actExt.getActivityId(),
					"验证OrderInfo.OrderItemList中ProductId=[" + expPid
							+ "]的OrderItemInfoExt.ActivityId");
			DataUtil.verify(expExt.getActivityTemplateId(),
					actExt.getActivityTemplateId(),
					"验证OrderInfo.OrderItemList中ProductId=[" + expPid
							+ "]的OrderItemInfoExt.ActivityTemplateId");
			DataUtil.verify(expExt.getGiftAvail4Reward(),
					actExt.getGiftAvail4Reward(),
					"验证OrderInfo.OrderItemList中ProductId=[" + expPid
							+ "]的OrderItemInfoExt.GiftAvail4Reward");
		}
	}

	private void ConstructExpectedResponse(GetSingleOrderInfoResp response) {
		Sp_GetSingleOrderInfo_1 sp = new Sp_GetSingleOrderInfo_1();
		sp.setOrderId(gsoibean.getOrderId());
		sp.setUserId(gsoibean.getUserId());
		sp.execute();
		OrderEntities result = ConvertResult(sp);
		List<com.ymatou.query.seller.trading.api.parameter.OrderInfo> orderInfos = OrderConverter
				.AsOrderInfos(result, false);
		if (DataUtil.isNullOrEmpty(orderInfos)) {
			response.setOrderInfo(null);
		} else {
			response.setOrderInfo(orderInfos.get(0));
		}
	}

	@SuppressWarnings("rawtypes")
	private OrderEntities ConvertResult(Sp_GetSingleOrderInfo_1 sp) {
		OrderEntities result = new OrderEntities();
		OrderEntities entity = new OrderEntities();
		List<Ymt_Order> Orders = new ArrayList<Ymt_Order>();
		List<Ymt_CreditDetail> CreditDetails = new ArrayList<Ymt_CreditDetail>();
		List<Ymt_O_OrderNote> OrderNotes = new ArrayList<Ymt_O_OrderNote>();
		List<Ymt_OrderState> OrderStates = new ArrayList<Ymt_OrderState>();
		List<Ymt_OrderPostPay> PostPays = new ArrayList<Ymt_OrderPostPay>();
		List<Ymt_OrderInfo> OrderInfos = new ArrayList<Ymt_OrderInfo>();
		List<Ymt_OrderSummary> OrderSummaries = new ArrayList<Ymt_OrderSummary>();
		List<Ymt_Order_Frozen> OrderFrozens = new ArrayList<Ymt_Order_Frozen>();
		List<Ymt_OrderToBill> OrderToBills = new ArrayList<Ymt_OrderToBill>();
		List<Ymt_Bill> Bills = new ArrayList<Ymt_Bill>();
		List<Ymt_TradingItem> TradingItems = new ArrayList<Ymt_TradingItem>();
		List<Ymt_OrderExt> OrderExts = new ArrayList<Ymt_OrderExt>();
		if (DataUtil.isNullOrEmpty(sp.getOrders()) == false) {
			for (Map m : sp.getOrders()) {
				Ymt_Order o = new Ymt_Order();
				DataUtil.mapToBean(o, m);
				Orders.add(o);
			}
		}
		if (DataUtil.isNullOrEmpty(sp.getCreditDetails()) == false) {
			for (Map m : sp.getCreditDetails()) {
				Ymt_CreditDetail o = new Ymt_CreditDetail();
				DataUtil.mapToBean(o, m);
				CreditDetails.add(o);
			}
		}
		if (DataUtil.isNullOrEmpty(sp.getNotes()) == false) {
			for (Map m : sp.getNotes()) {
				Ymt_O_OrderNote o = new Ymt_O_OrderNote();
				DataUtil.mapToBean(o, m);
				OrderNotes.add(o);
			}
		}
		if (DataUtil.isNullOrEmpty(sp.getStates()) == false) {
			for (Map m : sp.getStates()) {
				Ymt_OrderState o = new Ymt_OrderState();
				DataUtil.mapToBean(o, m);
				OrderStates.add(o);
			}
		}
		if (DataUtil.isNullOrEmpty(sp.getPostPays()) == false) {
			for (Map m : sp.getPostPays()) {
				Ymt_OrderPostPay o = new Ymt_OrderPostPay();
				DataUtil.mapToBean(o, m);
				PostPays.add(o);
			}
		}
		if (DataUtil.isNullOrEmpty(sp.getInfos()) == false) {
			for (Map m : sp.getInfos()) {
				Ymt_OrderInfo o = new Ymt_OrderInfo();
				DataUtil.mapToBean(o, m);
				OrderInfos.add(o);
			}
			if (DataUtil.isNullOrEmpty(sp.getSummarys()) == false) {
				for (Map m : sp.getSummarys()) {
					Ymt_OrderSummary o = new Ymt_OrderSummary();
					DataUtil.mapToBean(o, m);
					OrderSummaries.add(o);
				}
			}
			if (DataUtil.isNullOrEmpty(sp.getOrderFrozens()) == false) {
				for (Map m : sp.getOrderFrozens()) {
					Ymt_Order_Frozen o = new Ymt_Order_Frozen();
					DataUtil.mapToBean(o, m);
					OrderFrozens.add(o);
				}
			}
			if (DataUtil.isNullOrEmpty(sp.getOrderToBills()) == false) {
				for (Map m : sp.getOrderToBills()) {
					Ymt_OrderToBill o = new Ymt_OrderToBill();
					DataUtil.mapToBean(o, m);
					OrderToBills.add(o);
				}
			}
			if (DataUtil.isNullOrEmpty(sp.getBills()) == false) {
				for (Map m : sp.getBills()) {
					Ymt_Bill o = new Ymt_Bill();
					DataUtil.mapToBean(o, m);
					Bills.add(o);
				}
			}
			if (sp.getTradingItem().size() > 0) {
				Ymt_TradingItem o = new Ymt_TradingItem();
				o.setiOrderId((int) sp.getTradingItem().get("iOrderId"));
				o.setiTradingId((int) sp.getTradingItem().get("iTradingId"));
				TradingItems.add(o);
			}
			if (DataUtil.isNullOrEmpty(sp.getOrderExts()) == false) {
				for (Map m : sp.getOrderExts()) {
					Ymt_OrderExt o = new Ymt_OrderExt();
					DataUtil.mapToBean(o, m);
					OrderExts.add(o);
				}
			}
		}
		entity.setCreditDetails(CreditDetails);
		entity.setOrderExts(OrderExts);
		entity.setOrderFrozens(OrderFrozens);
		entity.setOrderInfos(OrderInfos);
		entity.setOrderNotes(OrderNotes);
		entity.setOrders(Orders);
		entity.setOrderStates(OrderStates);
		entity.setOrderSummaries(OrderSummaries);
		entity.setOrderToBills(OrderToBills);
		entity.setPostPays(PostPays);
		entity.setTradingItems(TradingItems);
		entity.setBills(Bills);
		entity.setTotalCount(DataUtil.isNullOrEmpty(result.getOrders()) ? 0
				: result.getOrders().size());
		return entity;
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(gsoicall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetSingleOrderInfo_001() {
		Logger.start(true, "获取单个订单信息成功");
		try {
			gsoibean.setOrderId(112490266);
			gsoibean.setUserId(3045216);
			// 发送请求
			gsoicall.setData(gsoibean);
			gsoicall.callService();
			Logger.comment("gsoicall send:" + gsoicall.getEntityString());
			Logger.comment("gsoicall response:" + gsoicall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, gsoicall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetSingleOrderInfo_002() {
		Logger.start(true, "用户id为空");
		try {
			gsoibean.setOrderId(105293318);
			// 发送请求
			gsoicall.setData(gsoibean);
			gsoicall.callService();
			Logger.comment("gsoicall send:" + gsoicall.getEntityString());
			Logger.comment("gsoicall response:" + gsoicall.getReturnData());
			Logger.verifyEquals(ECode.ERROR400, gsoicall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetSingleOrderInfo_003() {
		Logger.start(true, "订单编号id为空");
		try {
			gsoibean.setUserId(3793376);
			// 发送请求
			gsoicall.setData(gsoibean);
			gsoicall.callService();
			Logger.comment("gsoicall send:" + gsoicall.getEntityString());
			Logger.comment("gsoicall response:" + gsoicall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, gsoicall.getCode(), "验证Code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetSingleOrderInfo_004() {
		Logger.start(true, "用户id不存在");
		try {
			gsoibean.setOrderId(105293318);
			gsoibean.setUserId(1);
			// 发送请求
			gsoicall.setData(gsoibean);
			gsoicall.callService();
			Logger.comment("gsoicall send:" + gsoicall.getEntityString());
			Logger.comment("gsoicall response:" + gsoicall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, gsoicall.getCode(), "验证Code");
			Logger.verifyEquals(0, gsoicall.getOrderId(), "验证OrderId");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}